<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<h1>发布微博</h1>
<form action="" enctype="multipart/form-data">
    <input type="text" name="content" placeholder="说点什么....">
    <input type="file" name="picFile">
    <input type="button" value="发布" @click="send()">
</form>
<!--引入vue框架-->
<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.min.js"></script>
<script>
    let v=new Vue({
        el:"form",
        data:{},
        methods:{
            send:function () {
                //得到form表单中的数据
                let data=new FormData(document.querySelector("form"))

                axios.post("/send",data).then(function (response) {
                    if (response.data==1) {
                        alert("发布完成")
                        location.href="/             "
                    }else {
                        alert("没登入 登入去")
                        location.href="/login.html";
                    }
                })
            }
        }
    })
</script>
</body>
</html>